home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Overload Trio 2
/
Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO
/
dir27
/
cf427.zip
/
CF427.DOC
< prev
next >
Wrap
Text File
|
1994-02-06
|
16KB
|
337 lines
February 6 1994 (C) Copyright, 1994 John P Arkins
CurveFits v4.27
---------------
DISCLAIMER: Although effort has been taken to insure accurate
answers are obtained when using this program, the
USER assumes all risks when using this program.
Good practice dictates that sample data should be
used to determine the validity of calculations
performed by this program. If you are not willing
to assume all risks when using this program then
do not use it.
HISTORY
-------
CF101 -- January,1992 (Never Released)
CF251 -- August,1992
CF315 -- January,1993
CF427 -- February,1994
USING THE PROGRAM
-----------------
MAIN MENU
---------
The main menu has 6 selections :
(1) Create New Data File
(2) Load/Erase Data File
(3) Edit Data File
(4) Curve Fit Menu
(5) Exit Program
(6) Change Configuration
Options 3 and 4 cannot be executed without a data file being currently
loaded in memory. A file can be loaded into memory be either creating it
(option 1) or loading it from a file on disk(option 2).
CREATE DATA FILE
----------------
Enter the x and y data making sure to press enter after each. When
finished enter a blank for the y value. This is not the only way
to place data in a data file. Read CF&XY.DOC for more info.
Note: It is good practice to reduce the magnitude of the base 10
logarithm of the numbers you enter into this program, for it will
ensure more accurate calculations. For example, suppose one pair of
data is 5000000 P , 600000 L (where P and L represent some form of
units, Newtons,Coulombs etc.). It is better to enter the data as
5 MP (Mega P's) , 600 KL (Kilo L's). Just realize that the fitted
equation will be a function of MP and will output it's results in KL 's
The same is true for small numbers where 1e-6 P is 1 µP (1 Micro-P) etc.
Although the program accepts data pairs with repeated x values, realize
that a data file with much of it's data at the same x coordinate WILL
cause a run-time error and cause the program to abort. This is because
it is trying to invert a matrix whose determinant is zero or very near
zero.
LOAD/ERASE DATA FILE
--------------------
On this screen you can load or erase data (.DAT) files which are located
in the same directory as CF427.EXE. Simply scroll through the listing of
files with the up/down cursor keys. If you press enter the highlighted
file will be loaded into memory and you will return to the main menu. If
you press Alt-D the highlighted file will be deleted and you will return
to the main menu. Note: The page down and page up keys perform the same
action as the cursor up and cursor down keys except that they move the
highlight bar 10 positions instead of one.
EDIT DATA FILE
--------------
Selecting this option will allow you to edit your data file. To delete a
data pair press delete. You will then be asked for the number of the data
pair you wish to delete. Type in the appropriate number and then press
enter. The data pair has now been deleted. To edit a data pair press
enter. You will then be asked for the number of the data pair you wish
to edit. Enter the appropriate number and press enter. You will then be
prompted to enter the new x and y values. Press enter after you enter each
number. Pressing enter without entering a number will result in a zero
and not the old value for that coordinate. The cursor keys and the PgDn
and PgUp keys will perform the same actions as they do on the Load/Erase
data file screen.
CURVE FIT MENU
--------------
When the user selects this option he/she will see a flashing message
saying 'Calculating Data...'. At this point CurveFits is now determining
which fits are applicable to your data, and performing them. The time
required for this will increase with an increase in data points. After
this the curve fit menu will appear. Non-applicable fits will appear in
red text and will be unselectable. Use cursor keys to move the highlight
bar across and/or down to the fit you wish to perform. When the desired fit
is highlighted press enter. The fit with the best correlation coefficient
will be marked with an R. The fit with the lowest standard error will be
marked with a sigma. Selecting the best fit - standard error or
best fit - correlation coefficient will list the top 20 fits from best down
to worst. Since the equation for the correlation coefficient mentioned below
sometimes provides a correlation greater than one, fits with values greater
than one will be assigned a value of zero for this sort. CurveFits presently
supports 26 types of fits, 18 of which are more or less 'distinct'. The
fits which are similar or in some cases identical are:
Linear, Quadratic and Polynomial Fits
Exponential and Modified Power Fit
Root, Modified Hoerl and Modified Exponential Fit
Cauchy and Reciprocal Quadratic Fit
Inverse and Hyperbolic Fit
Reciprocal line and Reciprocal Quadratic Fits
For some fits the LN or the inverse of input data is used in the program's
calculations. For this reason these fits cannot support data containing
zeros and negatives or data containing zeros respectively. Other fits
will also may not be available if during the curve fitting calculations
their coefficients are determined to have values which will cause infinite
or undefined results, such as c = 0 for the Gaussian Fit. When a fit is
unavailable it will appear in red text on the curve fitting menu screen.
The 26 Fits and limitations are:
Name Equation Limitations
----------------------------------------------------------------------------
1 Linear : Y=A+B*X
2 Quadratic : Y=A+B*X+C*X^2
3 Power : Y=A*X^B X and Y greater than zero
4 Exponential : Y=A*EXP(B*X) X greater than zero
5 Logarithm : Y=A+B*LN(X) X greater than zero
6 Hyperbolic : Y=A+B/X Non-zero X
7 Super Geometric : Y=A*X^(B*X) X and Y greater than zero
8 Root : Y=A*B^(1/X) Non-zero X and Y > 0
9 Polynomial : Y=A+B*X+C*X^2 Will not accept repeated
X Values for divided diff.
10 Reciprocal Line : Y=1/(A+B*X) Non-zero Y
11 Reciprocal Quadratic : Y=1/(A+B*X+C*X^2) Non-zero Y
12 Modified Power : Y=A*B^X Y greater than zero
13 Modified Exponential : Y=A*EXP(B/X) Non-zero X and Y > 0
14 Reciprocal Logarithm : Y=1/(A+B*LN(X)) Non-zero Y and Y > 0
15 Reciprocal Hyperbolic : Y=X/(A+B*X) Non-zero X and Y
16 Modified Geometric : Y=A*X^(B*X) X and Y greater than zero
17 Heat Capacity : Y=A+B*X+C/X^2 Non-zero X
18 Vapor Pressure : Y=EXP(A+B/X+C*LN(X)) Non-zero X and Y > 0
19 Exponential Step : Y=A*(1-B*EXP(-X))
20 Sinusoidal : Y=A+B*SIN(X+C)
21 Gaussian : Y=A*EXP(-(X-B)^2/(2*C^2))
Y greater than zero
22 Inverse : Y=A+B/X+C/X^2 Non-zero X
23 Hoerl : Y=A*B^X*X^C X and Y greater than zero
24 Cauchy : Y=1/(A*(X+B)^2+C) Non-zero Y
25 Modified Hoerl : Y=A*B^(1/X)*X^C X and Y greater than zero
26 Log Normal : Y=A*EXP((LN(X)-B)^2/C)
X and Y greater than zero
----------------------------------------------------------------------------
POLYNOMIAL FIT
--------------
This fit requires at least four data points. If there are less than four
data points it will be unselectable and will appear in red text on the curve
fits menu screen. When this fit is chosen the user is prompted for the order of the fit
desired, the order referring to the number of coefficients in the desired
polynomial fit. If there are more than twenty data points the user will be
be asked for a value between four to twenty, if there are less than twenty
data points, say seventeen, the user will be asked for a value between four
and seventeen. If the order chosen is equal to the number of data points,
the user will then be given the option of doing the fit using either
Newton's forward divided difference or by the usual matrix method. Newton's
forward divided difference is more accurate than the matrix method however
it cannot accept repeated x values and it's order is not adjustable as is
the case with the matrix method. To exit the polynomial fit screen the user
must press enter without entering a value. If you are using the matrix
manipulation option and receive a correlation coefficient greater than 1,
reduce the order of the fit for better results.
GRAPH-SCREEN
------------
When the graph screen is active, these keys perform the described actions:
DESCRIPTION OF HOTKEYS:
-----------------------
When the graphing screen is active these hot-keys support
the described actions:
F1 -- TOGGLE GRID
Pressing this key will turn the 'grid' on or off. If the grid
is 'on' a message will be displayed on the bottom right hand
corner of the screen. The grid may not be on the screen at
first, if this is true you must reduce the x and y grid spacing
by pressing < and , keys respectively. If the grid spacing
is too small the grid will not be displayed, and a message
will be displayed on the bottom right hand corner of the
screen.
F2 -- TOGGLE GRID LABELING
Pressing this key will toggle labeling of the grid. If the
grid is too dense it will not be labeled.
F3 -- TOGGLES CIRCLING OF DATA POINTS
This key will toggles the circling of the input data points.
F4 -- TOGGLES ZOOM WINDOW
This key will turn on/off the zoom window which graphically
highlights the area which will be seen if Shft-Z is pressed.
F5 -- TOGGLES TITLING OF GRAPH
This key will turn on/off all text display on the graph screen.
F6 -- TOGGLES LINE THICKNESS
F7 -- TOGGLES GRAPHING ALONG X RANGE(Polynomial Only)
If on, the curve will only be graphed from the lowest x value
to the largest x value.
F8 -- TOGGLES XSCALE = YSCALE
If on, the x and y axes will have the same scale(EGA,VGA)
F9 -- CHANGES LINE COLOR
( ) -- MOVE VIEWPOINT OF GRAPH (CURSOR KEYS)
The cursor keys move the viewpoint area on the graph.
(+ -) -- INCREASES/DECREASES CALCULATION STEP SIZE (PLUS/MINUS KEYS)
These keys will double/halve the calculation step size of the
graphed curve.
([ ]) -- ADJUST CURSOR MOVEMENT ( SQUARE BRACKET KEYS )
Will increase/decrease the distance moved when the cursor
keys are pressed.
(If NUMLOCK is on, the numeric keypad's arrows will move
1/3 the distance of the cursor keys)
(, .) -- ADJUSTS X GRID SPACING (COMMA AND PERIOD KEYS)
(,) Decreases X grid spacing by a factor of ten
(.) Increases X grid spacing by a factor of ten
(< >) -- ADJUSTS Y GRID SPACING (LESS THAN/GREATER THAN KEYS)
Analogous to the above.
(/) -- TOGGLES DIVISION OF X GRID SPACING BY 2 (BACK-SLASH KEY)
(?) -- TOGGLES DIVISION OF Y GRID SPACING BY 2 (QUESTION MARK KEY)
(C) -- COEFFICIENTS OF EQUATIONS
Will display the coefficients of the fitted equations
using scientific notation with 18 significant figures.
(D) -- DATA COMPARISON
Will display a comparison between the original data
an the calculated values. The arrow keys will allow
the user to scroll up and down through the data.
(Shft-P) -- CREATE DOS TEXT FILE
Creates DOS text file containing Equation type,
coefficients, input data, data from fitted equation
and the standard error, maximum error and correlation
coefficient.
(Shft-L) -- OUTPUT TO HP LASERJET COMPATIBLE PRINTER
Printing can be aborted at any time by pressing the ESC
key. Works with printers attached to the Comm ports if the
appropriate MODE command has been issued at the DOS prompt.
Output resolution is limited to that of the display adapter
in use.
(F) -- TOGGLES FULLSCALE DISPLAY (POLYNOMIAL FIT ONLY)
This will show the entire curve within the x data range
on the screen.
(R) -- RESETS GRAPH SETTINGS
Resets zoom and grid parameters and centers plot.
(V) -- CALCULATE VALUE FROM EQUATION
Allows user to calculate a value using the fitted equation
(X) -- EXPANDS X RANGE
Increases the scale of the x axis without altering the
scaling of the y axis.
(Shft X) -- DECREASES X RANGE
(Y) -- EXPANDS Y RANGE
(Shft Y) -- DECREASES Y RANGE
(Z) -- ZOOM IN
(Shft Z) -- ZOOM OUT
EXIT PROGRAM
------------
The user can exit the program by selecting this option or by pressing the
ESC key. The ESC key will cause an exit from most screens within the
program.
CHANGE CONFIGURATION
--------------------
This option allows for the changing of the default settings of CurveFits
graphing screen, whether the grid is initially on or off etc. It also allows
for the changing of the colors used on the graphing screen. If for some
reason you want all the original settings back, merely delete the file
CF427.CFG. When CurveFits looks for this file and cannot find it it will
automatically create a new one with the original settings.
MISCELLANEOUS NOTES:
--------------------
COMPUTATIONS:
-------------
Standard Error:
The standard error is calculated as follows:
StErr := SQRT(SumErrSqr/(N-2))
Correlation Coefficient:
------------------------
R:=SQRT(1-SumErrSqr/(SumY2-SQR(SumY*SumY)/N))
where:
SumErrSq is the sum of the sum of the squared difference between
the calculated values and actual data.
SumY2 is the sum of the squares of the Y data
N is the number of data points
SumY is the sum of the Y data
This formula will sometimes return a correlation greater than one. This
is usually indicative of a poor fit.
COMMAND LINE PARAMETERS
-----------------------
If you already have a data file you want to run the CurveFits program on,
you can specify it from the command line. For example, when you are within
the directory CurveFits is contained in, type CF427 LINEAR to run the
CurveFits program on a file called LINEAR.DAT. Notice that you omit the
file extension. This process will skip the opening screen and the main menu
and take you directly to the curve fitting menu.
PROGRAM
-------
CF427 uses Turbo Pascal's extended real data type. This data type allows
for 18-19 digit accuracy in computations. However, this data type requires
a math coprocessor. If no coprocessor is detected on your computer the
program will use it's own software emulation of a math coprocessor.
This emulation utilizes the main CPU however and will slow down the
program's performance considerably. The program runs at an acceptable
speed on my computer which is an 80386-20MHz with a 80387 math coprocessor.
SHAREWARE NOTICE:
-----------------
The program Curvefits v4.27 and this text file are not in the public
domain, they are shareware. Please register your copy by sending $25
to the below address.
John P Arkins
54 Pearl Street
NHP, NY 11040
Any questions or suggestions can also be sent to the author by E-mail to:
CID : 73633,3417
Internet : 73633.3417@CompuServe.Com